package com.tubi.MyCountDownLatch;

import java.util.concurrent.CountDownLatch;

public class demo {

    /*
    * | 方法                             | 解释                             |
| -------------------------------- | -------------------------------- |
| public CountDownLatch(int count) | 参数传递线程数，表示等待线程数量 |
| public void await()              | 让线程等待                       |
| public void countDown()          | 当前线程执行完毕                 |
    * */
    public static void main(String[] args) {
        CountDownLatch countDownLatch = new CountDownLatch(3);
//        创建四个线程
        MOtner m = new MOtner(countDownLatch);
        m.start();

        ch1 c1 = new ch1(countDownLatch);
        c1.setName("小红");
        ch2 c2 = new ch2(countDownLatch);
        c2.setName("小明");
        ch3 c3 = new ch3(countDownLatch);
        c3.setName("小黑");

        c1.start();
        c2.start();
        c3.start();

    }
}
